<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.backupDB.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.frame.util.Config" %>
<%@ page import="java.io.*"%>

<%
request.setCharacterEncoding("UTF-8");
/***********************基本信息***********************/
Config cfg = new Config();
cfg.init();
String dbName = cfg.getString("mysqlbase.sid");
String root_path = cfg.getString("rootpath");
Backup backup = new Backup();

int counter=0;

ArrayList bakfileList = DataMgr.getBakInfo(root_path + cfg.getString("database_backup_files_path"));
if(bakfileList != null && bakfileList.size() > 0){
	counter = bakfileList.size();
}

%>

<html>
  <head>
    
    <title>数据库备份还原</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script type="text/javascript" src="backup.js"></script> 
	<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>	
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>数据库备份还原管理</h1>
			</td>
			<td>
				
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
	
	<!--
	<table width="100%" align="center" cellpadding="0" cellspacing="0" class="dl_so">
        <tr>
          <td width="9%" align="center"><img src="/program/admin/index/images/ban_01.gif" /></td>
          <td width="91%" align="left">
		  <h4>-----------------</h4>
		  <span>1----------------。</span><br/>
		  <span>2----------------。</span>
		  </td>
        </tr>
      </table>
      <br/>
	  -->
	  
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left">
				数据库表名:<input name="s_pay_name" id="s_pay_name" type="text" />
			
			<input name="searchInfo" type="button" value="查询" onclick="return search();"/></td>
		</tr>
	</table>



	
	<% 
		int listsize = 0;
		if(bakfileList!=null && bakfileList.size()>0){
			listsize = bakfileList.size();
	%>
	
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="89%">
				
			</td>

			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"></th>
		  	
		  	<th>文件名</th>
		  	
		  	<th>大小</th>

			<th width="20%">操作</th>
		</tr>
		
		
		<% 
		for(int i=0;i<bakfileList.size();i++){
			DataFile dataFile = (DataFile)bakfileList.get(i);
			String fileName = dataFile.getFileName();
			long fileSize = dataFile.getFileSize();			

		  %>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=fileName%>" /></td>

		  	<td><%=fileName%></td>
		  	<td><%=fileSize%>Byte</td>

	  		<td width="20%">
				<a href="delBakFile.jsp?file_name=<%=fileName%>">删除</a>			
			</td>
		</tr>
		
		  <%
		  		}
		  %>
	<tr>
		<th colspan="4" align="center">
			<input type="button"  class="buttoncss" value="还原数据" class="submitButton" onclick="restore()"/>&nbsp;&nbsp;
			<input type="button"  class="buttoncss" value="返回" class="submitButton" onclick="javascript:window.location.href='index.jsp'"/>
		</th>
	</tr>	
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="89%">
				
			</td>

			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>

	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
		<input type="hidden" id="backup_dbname" name="backup_dbname" value="">
		<input type="hidden" id="bpm_id" name="bpm_id" value="0015">
	  </form>
</body>

</html>
